local wdtx__savageAssaultSkill = fk.CreateSkill {
  name = "wdtx__savage_assault_skill",
}


wdtx__savageAssaultSkill:addEffect("cardskill", {
  prompt = "#wdtx__savage_assault_skill",
  can_use = Util.AoeCanUse,
  on_use = function(self, room, cardUseEvent)
    local mark = cardUseEvent.card:getMark("@up_easyhurt")
    if mark > 0 then
      cardUseEvent.disresponsiveList = room.alive_players
    end
    return Util.AoeCardOnUse(self, cardUseEvent.from, cardUseEvent, false)
  end,
  mod_target_filter = function(self, player, to_select, selected)
    return player ~= to_select
  end,
  on_effect = function(self, room, effect)
    local loopTimes = effect:getResponseTimes()
    local respond
    for i = 1, loopTimes do
      local params = { ---@type AskToUseCardParams
        skill_name = 'slash',
        pattern = 'slash',
        cancelable = true,
        event_data = effect
      }
      if loopTimes > 1 then
        params.prompt = "#AskForResponseMultiCard:::slash:"..i..":"..loopTimes
      end
      respond = room:askToResponse(effect.to, params)
      if respond then
        room:responseCard(respond)
      else
        room:damage({
          from = effect.from,
          to = effect.to,
          card = effect.card,
          damage = 1,
          damageType = fk.NormalDamage,
          skillName = wdtx__savageAssaultSkill.name,
        })
        if room.logic.class.name == "wdtx_logic" and effect.card:getMark("@up_easyhurt") > 0 then
          local to = effect.to
          room:addPlayerMark(to,"@up_easyhurt",effect.card:getMark("@up_easyhurt") + 1)
          if not to:hasSkill("easyHurtSkill") then
            room:handleAddLoseSkills(to, "easyHurtSkill", nil, false)
          end
        end
        break
      end
      if effect.to.dead then break end
    end
  end
})


return wdtx__savageAssaultSkill